import { http } from "@/utils/http"
import { CommonResponse } from "./common"

// 查询产品分页
export const getProductList = (data: any) => {
  return http.request<CommonResponse<any>>("post", "/api/platform/products/page", { data })
}

// 查询产品详情
export const getProductDetail = (id: any) => {
  return http.request<CommonResponse<any>>("get", `/api/platform/products/${id}`)
}

// 创建产品
export const createProduct = (data: any) => {
  return http.request<CommonResponse<any>>("post", "/api/platform/products/create", { data })
}

/**
 * 查询试卷列表
 */
export const getPaperList = (data: { name: string, groupName: string, guid: string }) => {
  return http.request<CommonResponse<any>>("post", "/api/platform/paper/simple/list", { data })
}

/**
 * 更新产品状态
 */
export const updateProductStatus = (data: { id: number, status: number }) => {
  return http.request<CommonResponse<any>>("post", `/api/platform/products/${data.id}/status`, { params: { status: data.status } })
}